home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Tutorial / Cookbook / 14.pie_matrix / slice.psw < prev   
Text File  |  1995-06-12  |  679b  |  33 lines

  1. defineps drawSlice (float grayshade; float radius; float startangle; float  endangle; float labelps; char *thelabel)
  2.     1 setlinewidth
  3.     newpath 0 0 moveto
  4.      0 0 radius startangle endangle arc
  5.    closepath
  6.    1.415 setmiterlimit
  7.  
  8.    gsave
  9.     grayshade setgray
  10.     fill
  11.    grestore
  12.    stroke
  13.    gsave
  14.     startangle endangle add 2 div rotate
  15.  
  16.     radius 0 translate
  17.     newpath
  18.       0 0 moveto labelps .8 mul 0 lineto stroke
  19.     labelps 0 translate
  20.     0 0 transform
  21.    grestore
  22.    itransform
  23.    /y exch def /x exch def
  24.    x y moveto
  25.  
  26.    x 0 lt
  27.       { (thelabel) stringwidth pop neg 0 rmoveto }
  28.       if
  29.     y 0 lt { 0 labelps neg rmoveto } if
  30.     (thelabel) show
  31. endps
  32.  
  33.